package com.gitee.wsl.collections.set

import androidx.collection.FloatSet
import androidx.collection.MutableFloatSet


/**
 * Returns an empty, read-only [FloatSet].
 */
fun Sets.emptyFloatSet(): FloatSet = androidx.collection.emptyFloatSet()

/**
 * Returns an empty, read-only [ScatterSet].
 */
@Suppress("UNCHECKED_CAST")
fun Sets.floatSetOf(): FloatSet = androidx.collection.floatSetOf()

/**
 * Returns a new read-only [FloatSet] with only [element1] in it.
 */
@Suppress("UNCHECKED_CAST")
fun Sets.floatSetOf(element1: Float): FloatSet = mutableFloatSetOf(element1)

/**
 * Returns a new read-only [FloatSet] with only [element1] and [element2] in it.
 */
@Suppress("UNCHECKED_CAST")
fun Sets.floatSetOf(element1: Float, element2: Float): FloatSet =
    mutableFloatSetOf(element1, element2)

/**
 * Returns a new read-only [FloatSet] with only [element1], [element2], and [element3] in it.
 */
@Suppress("UNCHECKED_CAST")
fun Sets.floatSetOf(element1: Float, element2: Float, element3: Float): FloatSet =
    mutableFloatSetOf(element1, element2, element3)

/**
 * Returns a new read-only [FloatSet] with only [elements] in it.
 */
@Suppress("UNCHECKED_CAST")
fun Sets.floatSetOf(vararg elements: Float): FloatSet =
    MutableFloatSet(elements.size).apply { plusAssign(elements) }

/**
 * Returns a new [MutableFloatSet].
 */
fun Sets.mutableFloatSetOf(): MutableFloatSet = MutableFloatSet()

/**
 * Returns a new [MutableFloatSet] with only [element1] in it.
 */
fun Sets.mutableFloatSetOf(element1: Float): MutableFloatSet =
    MutableFloatSet(1).apply {
        plusAssign(element1)
    }

/**
 * Returns a new [MutableFloatSet] with only [element1] and [element2] in it.
 */
fun Sets.mutableFloatSetOf(element1: Float, element2: Float): MutableFloatSet =
    MutableFloatSet(2).apply {
        plusAssign(element1)
        plusAssign(element2)
    }

/**
 * Returns a new [MutableFloatSet] with only [element1], [element2], and [element3] in it.
 */
fun Sets.mutableFloatSetOf(element1: Float, element2: Float, element3: Float): MutableFloatSet =
    MutableFloatSet(3).apply {
        plusAssign(element1)
        plusAssign(element2)
        plusAssign(element3)
    }

/**
 * Returns a new [MutableFloatSet] with the specified elements.
 */
fun Sets.mutableFloatSetOf(vararg elements: Float): MutableFloatSet =
    MutableFloatSet(elements.size).apply { plusAssign(elements) }
